package com.ssy.lingxi.platform.template.service.controller.web;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.template.service.entity.door.MemberChannel;
import com.ssy.lingxi.platform.template.service.model.dto.common.MemberIdDTO;
import com.ssy.lingxi.platform.template.service.model.dto.web.SaveChannelDTO;
import com.ssy.lingxi.platform.template.service.model.vo.web.MemberChannelMainVO;
import com.ssy.lingxi.platform.template.service.service.web.MemberChannelWebService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu web - 会员渠道门户
 * @author fhj
 * @version 2.0.0
 * @date 2020/12/25
 */
@Api(tags = "web - 会员渠道门户")
@RestController
@RequestMapping("/template/web/memberChannelWeb")
public class MemberChannelWebController extends BaseController {

    @Resource
    private MemberChannelWebService memberChannelWebService;

    @ApiOperation(value = "保存当前登录会员的渠道门户")
    @PostMapping("/saveCurrMemberChannel")
    public Wrapper<Void> saveCurrMemberChannel(@RequestBody @Valid SaveChannelDTO dto) {
        return memberChannelWebService.saveCurrMemberChannel(dto, getSysUser());
    }

    @ApiOperation(value = "获取当前登录会员的渠道门户")
    @GetMapping("/findCurrMemberChannel")
    public Wrapper<MemberChannel> findCurrMemberChannel() {
        return memberChannelWebService.findCurrMemberChannel(getSysUser());
    }

    @ApiOperation(value = "渠道门户主页")
    @GetMapping("/memberChannelMain")
    public Wrapper<MemberChannelMainVO> memberChannelMain(@Valid MemberIdDTO dto) {
        return memberChannelWebService.memberChannelMain(dto);
    }

    @ApiOperation(value = "所有")
    @GetMapping("/all")
    public Wrapper<List<MemberChannel>> all() {
        return memberChannelWebService.all();
    }
}
